# -*- coding:utf-8 -*-
#2022/2/22 16:46
# author:xwl

from fastapi import APIRouter, Depends

from backend.app.app.api.api_Xiong.crud.pri_crud import unit_scheme_curve_data_recovery_save_data, \
    unit_scheme_curve_data_recovery_return_data
from backend.app.app.api.api_Xiong.models.x_model import unit_scheme_curve_data_recovery_data, return_data
from backend.app.app.api.api_v1.user import verify_token_user

unit_scheme_curve_data_recovery = APIRouter(prefix="/unit_scheme_curve_data_recovery", tags=["单元方案曲线数据恢复"])


@unit_scheme_curve_data_recovery.post("/save", name="存库")
async def unit_scheme_curve_data_recovery_save(data: unit_scheme_curve_data_recovery_data, ver=Depends(verify_token_user)):
    result = unit_scheme_curve_data_recovery_save_data(data.User_ID, data.Proj_ID, data.Data)
    return {
        "result": result,
        'verify': ver
    }

@unit_scheme_curve_data_recovery.post("/return", name="返回")
async def unit_scheme_curve_data_recovery_return(data:return_data, ver=Depends(verify_token_user)):
    result = unit_scheme_curve_data_recovery_return_data(data.User_ID, data.Proj_ID)
    return {
        "result": result,
        'verify': ver
    }
